import { Component } from "react";
import PropTypes from "prop-types";

export default class Votefooter extends Component{
    static contextTypes={//后代组件，接收参数(参数的格式，必须与祖先一致)
        add:PropTypes.func
    }
    render(){
        //接收后，参数就在this.context里面，接收几个，里面就有几个参数
        let {add}=this.context;
        return <div>
                <button onClick={()=>{
                    add("sup")
                }}>支持</button>
                <button onClick={add.bind(null,"opp")}>反对</button>
            </div>
    }
}